diff --git a/package.json b/package.json index c0aec9a5..24e1a167 100644 --- a/package.json +++ b/package.json @@ -83,16 +83,16 @@ "vue": "3.5.17", "vue-advanced-cropper": "^2.8.9", "vue-draggable-plus": "0.6.0", - "vue-i18n": "11.1.9", + "vue-i18n": "11.1.10", "vue-router": "4.5.1" }, "devDependencies": { "@elegant-router/vue": "0.3.8", - "@iconify/json": "2.2.357", + "@iconify/json": "2.2.359", "@sa/scripts": "workspace:*", "@sa/uno-preset": "workspace:*", "@soybeanjs/eslint-config": "1.7.1", - "@types/node": "24.0.13", + "@types/node": "24.0.15", "@types/nprogress": "0.2.3", "@unocss/eslint-config": "66.3.3", "@unocss/preset-icons": "66.3.3", @@ -112,14 +112,14 @@ "typescript": "5.8.3", "unplugin-icons": "22.1.0", "unplugin-vue-components": "28.8.0", - "vite": "7.0.4", + "vite": "7.0.5", "vite-plugin-monaco-editor": "^1.1.0", "vite-plugin-progress": "0.0.7", "vite-plugin-static-copy": "^3.1.0", "vite-plugin-svg-icons": "2.0.1", "vite-plugin-vue-devtools": "7.7.7", "vue-eslint-parser": "10.2.0", - "vue-tsc": "3.0.1" + "vue-tsc": "3.0.3" }, "simple-git-hooks": { "commit-msg": "pnpm sa git-commit-verify", diff --git a/packages/axios/src/index.ts b/packages/axios/src/index.ts index 89a6bf8a..28767699 100644 --- a/packages/axios/src/index.ts +++ b/packages/axios/src/index.ts @@ -13,11 +13,12 @@ import type { ResponseType } from './type'; -function createCommonRequest( - axiosConfig?: CreateAxiosDefaults, - options?: Partial> -) { - const opts = createDefaultOptions(options); +function createCommonRequest< + ResponseData, + ApiData = ResponseData, + State extends Record = Record +>(axiosConfig?: CreateAxiosDefaults, options?: Partial>) { + const opts = createDefaultOptions(options); const axiosConf = createAxiosConfig(axiosConfig); const instance = axios.create(axiosConf); @@ -80,14 +81,6 @@ function createCommonRequest( } ); - function cancelRequest(requestId: string) { - const abortController = abortControllerMap.get(requestId); - if (abortController) { - abortController.abort(); - abortControllerMap.delete(requestId); - } - } - function cancelAllRequest() { abortControllerMap.forEach(abortController => { abortController.abort(); @@ -98,7 +91,6 @@ function createCommonRequest( return { instance, opts, - cancelRequest, cancelAllRequest }; } @@ -109,27 +101,27 @@ function createCommonRequest( * @param axiosConfig axios config * @param options request options */ -export function createRequest>( +export function createRequest>( axiosConfig?: CreateAxiosDefaults, - options?: Partial> + options?: Partial> ) { - const { instance, opts, cancelRequest, cancelAllRequest } = createCommonRequest(axiosConfig, options); + const { instance, opts, cancelAllRequest } = createCommonRequest(axiosConfig, options); - const request: RequestInstance = async function request( - config: CustomAxiosRequestConfig - ) { + const request: RequestInstance = async function request< + T extends ApiData = ApiData, + R extends ResponseType = 'json' + >(config: CustomAxiosRequestConfig) { const response: AxiosResponse = await instance(config); const responseType = response.config?.responseType || 'json'; if (responseType === 'json') { - return opts.transformBackendResponse(response); + return opts.transform(response); } return response.data as MappedType; - } as RequestInstance; + } as RequestInstance; - request.cancelRequest = cancelRequest; request.cancelAllRequest = cancelAllRequest; request.state = {} as State; @@ -144,14 +136,14 @@ export function createRequest>( +export function createFlatRequest>( axiosConfig?: CreateAxiosDefaults, - options?: Partial> + options?: Partial> ) { - const { instance, opts, cancelRequest, cancelAllRequest } = createCommonRequest(axiosConfig, options); + const { instance, opts, cancelAllRequest } = createCommonRequest(axiosConfig, options); - const flatRequest: FlatRequestInstance = async function flatRequest< - T = any, + const flatRequest: FlatRequestInstance = async function flatRequest< + T extends ApiData = ApiData, R extends ResponseType = 'json' >(config: CustomAxiosRequestConfig) { try { @@ -160,20 +152,21 @@ export function createFlatRequest, error: null }; + return { data: response.data as MappedType, error: null, response }; } catch (error) { return { data: null, error, response: (error as AxiosError).response }; } - } as FlatRequestInstance; + } as FlatRequestInstance; - flatRequest.cancelRequest = cancelRequest; flatRequest.cancelAllRequest = cancelAllRequest; - flatRequest.state = {} as State; + flatRequest.state = { + ...opts.defaultState + } as State; return flatRequest; } diff --git a/packages/axios/src/options.ts b/packages/axios/src/options.ts index 8b2b116a..e7866397 100644 --- a/packages/axios/src/options.ts +++ b/packages/axios/src/options.ts @@ -4,15 +4,27 @@ import { stringify } from 'qs'; import { isHttpSuccess } from './shared'; import type { RequestOption } from './type'; -export function createDefaultOptions(options?: Partial>) { - const opts: RequestOption = { +export function createDefaultOptions< + ResponseData, + ApiData = ResponseData, + State extends Record = Record +>(options?: Partial>) { + const opts: RequestOption = { + defaultState: {} as State, + transform: async response => response.data as unknown as ApiData, + transformBackendResponse: async response => response.data as unknown as ApiData, onRequest: async config => config, isBackendSuccess: _response => true, onBackendFail: async () => {}, - transformBackendResponse: async response => response.data, onError: async () => {} }; + if (options?.transform) { + opts.transform = options.transform; + } else { + opts.transform = options?.transformBackendResponse || opts.transform; + } + Object.assign(opts, options); return opts; diff --git a/packages/axios/src/type.ts b/packages/axios/src/type.ts index 644847ff..846950c4 100644 --- a/packages/axios/src/type.ts +++ b/packages/axios/src/type.ts @@ -8,7 +8,30 @@ export type ContentType = | 'application/x-www-form-urlencoded' | 'application/octet-stream'; -export interface RequestOption { +export type ResponseTransform = (input: Input) => Output | Promise; + +export interface RequestOption< + ResponseData, + ApiData = ResponseData, + State extends Record = Record +> { + /** + * The default state + */ + defaultState?: State; + /** + * transform the response data to the api data + * + * @param response Axios response + */ + transform: ResponseTransform, ApiData>; + /** + * transform the response data to the api data + * + * @deprecated use `transform` instead, will be removed in the next major version v3 + * @param response Axios response + */ + transformBackendResponse: ResponseTransform, ApiData>; /** * The hook before request * @@ -35,12 +58,6 @@ export interface RequestOption { response: AxiosResponse, instance: AxiosInstance ) => Promise | Promise; - /** - * transform backend response when the responseType is json - * - * @param response Axios response - */ - transformBackendResponse(response: AxiosResponse): any | Promise; /** * The hook to handle error * @@ -68,15 +85,7 @@ export type CustomAxiosRequestConfig = Omit { - /** - * cancel the request by request id - * - * if the request provide abort controller sign from config, it will not collect in the abort controller map - * - * @param requestId - */ - cancelRequest: (requestId: string) => void; +export interface RequestInstanceCommon> { /** * cancel all request * @@ -84,32 +93,35 @@ export interface RequestInstanceCommon { */ cancelAllRequest: () => void; /** you can set custom state in the request instance */ - state: T; + state: State; } /** The request instance */ -export interface RequestInstance> extends RequestInstanceCommon { - (config: CustomAxiosRequestConfig): Promise>; +export interface RequestInstance> extends RequestInstanceCommon { + ( + config: CustomAxiosRequestConfig + ): Promise>; } -export type FlatResponseSuccessData = { - data: T; +export type FlatResponseSuccessData = { + data: ApiData; error: null; response: AxiosResponse; }; -export type FlatResponseFailData = { +export type FlatResponseFailData = { data: null; error: AxiosError; response: AxiosResponse; }; -export type FlatResponseData = - | FlatResponseSuccessData +export type FlatResponseData = + | FlatResponseSuccessData | FlatResponseFailData; -export interface FlatRequestInstance, ResponseData = any> extends RequestInstanceCommon { - ( +export interface FlatRequestInstance> + extends RequestInstanceCommon { + ( config: CustomAxiosRequestConfig - ): Promise, ResponseData>>; + ): Promise>>; } diff --git a/packages/hooks/src/index.ts b/packages/hooks/src/index.ts index a6a330bd..3a73bbc7 100644 --- a/packages/hooks/src/index.ts +++ b/packages/hooks/src/index.ts @@ -3,9 +3,7 @@ import useLoading from './use-loading'; import useCountDown from './use-count-down'; import useContext from './use-context'; import useSvgIconRender from './use-svg-icon-render'; -import useHookTable from './use-table'; +import useTable from './use-table'; -export { useBoolean, useLoading, useCountDown, useContext, useSvgIconRender, useHookTable }; - -export * from './use-signal'; -export * from './use-table'; +export { useBoolean, useLoading, useCountDown, useContext, useSvgIconRender, useTable }; +export type * from './use-table'; diff --git a/packages/hooks/src/use-context.ts b/packages/hooks/src/use-context.ts index 001d8aa6..cea9164f 100644 --- a/packages/hooks/src/use-context.ts +++ b/packages/hooks/src/use-context.ts @@ -1,5 +1,4 @@ import { inject, provide } from 'vue'; -import type { InjectionKey } from 'vue'; /** * Use context @@ -12,7 +11,7 @@ import type { InjectionKey } from 'vue'; * import { ref } from 'vue'; * import { useContext } from '@sa/hooks'; * - * export const { setupStore, useStore } = useContext('demo', () => { + * export const [provideDemoContext, useDemoContext] = useContext('demo', () => { * const count = ref(0); * * function increment() { @@ -35,10 +34,10 @@ import type { InjectionKey } from 'vue'; *
A
* * * ``` // B.vue * ```vue @@ -46,9 +45,9 @@ import type { InjectionKey } from 'vue'; *
B
* * * ```; * @@ -57,40 +56,41 @@ import type { InjectionKey } from 'vue'; * @param contextName Context name * @param fn Context function */ -export default function useContext any>(contextName: string, fn: T) { - type Context = ReturnType; +export default function useContext, T>( + contextName: string, + composable: (...args: Arguments) => T +) { + const key = Symbol(contextName); - const { useProvide, useInject: useStore } = createContext(contextName); + /** + * Injects the context value. + * + * @param consumerName - The name of the component that is consuming the context. If provided, the component must be + * used within the context provider. + * @param defaultValue - The default value to return if the context is not provided. + * @returns The context value. + */ + const useInject = ( + consumerName?: N, + defaultValue?: T + ): N extends null | undefined ? T | null : T => { + const value = inject(key, defaultValue); - function setupStore(...args: Parameters) { - const context: Context = fn(...args); - return useProvide(context); - } + if (consumerName && !value) { + throw new Error(`\`${consumerName}\` must be used within \`${contextName}\``); + } - return { - /** Setup store in the parent component */ - setupStore, - /** Use store in the child component */ - useStore + // @ts-expect-error - we want to return null if the value is undefined or null + return value || null; }; -} -/** Create context */ -function createContext(contextName: string) { - const injectKey: InjectionKey = Symbol(contextName); + const useProvide = (...args: Arguments) => { + const value = composable(...args); - function useProvide(context: T) { - provide(injectKey, context); + provide(key, value); - return context; - } - - function useInject() { - return inject(injectKey) as T; - } - - return { - useProvide, - useInject + return value; }; + + return [useProvide, useInject] as const; } diff --git a/packages/hooks/src/use-request.ts b/packages/hooks/src/use-request.ts index a0a40e63..219ac07f 100644 --- a/packages/hooks/src/use-request.ts +++ b/packages/hooks/src/use-request.ts @@ -6,31 +6,31 @@ import type { CreateAxiosDefaults, CustomAxiosRequestConfig, MappedType, + RequestInstanceCommon, RequestOption, ResponseType } from '@sa/axios'; import useLoading from './use-loading'; -export type HookRequestInstanceResponseSuccessData = { - data: Ref; +export type HookRequestInstanceResponseSuccessData = { + data: Ref; error: Ref; }; -export type HookRequestInstanceResponseFailData = { +export type HookRequestInstanceResponseFailData = { data: Ref; error: Ref>; }; -export type HookRequestInstanceResponseData = { +export type HookRequestInstanceResponseData = { loading: Ref; -} & (HookRequestInstanceResponseSuccessData | HookRequestInstanceResponseFailData); +} & (HookRequestInstanceResponseSuccessData | HookRequestInstanceResponseFailData); -export interface HookRequestInstance { - ( +export interface HookRequestInstance> + extends RequestInstanceCommon { + ( config: CustomAxiosRequestConfig - ): HookRequestInstanceResponseData, ResponseData>; - cancelRequest: (requestId: string) => void; - cancelAllRequest: () => void; + ): HookRequestInstanceResponseData>; } /** @@ -39,25 +39,26 @@ export interface HookRequestInstance { * @param axiosConfig * @param options */ -export default function createHookRequest( +export default function createHookRequest>( axiosConfig?: CreateAxiosDefaults, - options?: Partial> + options?: Partial> ) { - const request = createFlatRequest(axiosConfig, options); + const request = createFlatRequest(axiosConfig, options); - const hookRequest: HookRequestInstance = function hookRequest( - config: CustomAxiosRequestConfig - ) { + const hookRequest: HookRequestInstance = function hookRequest< + T extends ApiData = ApiData, + R extends ResponseType = 'json' + >(config: CustomAxiosRequestConfig) { const { loading, startLoading, endLoading } = useLoading(); - const data = ref | null>(null) as Ref>; - const error = ref | null>(null) as Ref | null>; + const data = ref(null) as Ref>; + const error = ref(null) as Ref | null>; startLoading(); request(config).then(res => { if (res.data) { - data.value = res.data; + data.value = res.data as MappedType; } else { error.value = res.error; } @@ -70,9 +71,8 @@ export default function createHookRequest( data, error }; - } as HookRequestInstance; + } as HookRequestInstance; - hookRequest.cancelRequest = request.cancelRequest; hookRequest.cancelAllRequest = request.cancelAllRequest; return hookRequest; diff --git a/packages/hooks/src/use-signal.ts b/packages/hooks/src/use-signal.ts deleted file mode 100644 index fa9d6265..00000000 --- a/packages/hooks/src/use-signal.ts +++ /dev/null @@ -1,144 +0,0 @@ -import { computed, ref, shallowRef, triggerRef } from 'vue'; -import type { - ComputedGetter, - DebuggerOptions, - Ref, - ShallowRef, - WritableComputedOptions, - WritableComputedRef -} from 'vue'; - -type Updater = (value: T) => T; -type Mutator = (value: T) => void; - -/** - * Signal is a reactive value that can be set, updated or mutated - * - * @example - * ```ts - * const count = useSignal(0); - * - * // `watchEffect` - * watchEffect(() => { - * console.log(count()); - * }); - * - * // watch - * watch(count, value => { - * console.log(value); - * }); - * - * // useComputed - * const double = useComputed(() => count() * 2); - * const writeableDouble = useComputed({ - * get: () => count() * 2, - * set: value => count.set(value / 2) - * }); - * ``` - */ -export interface Signal { - (): Readonly; - /** - * Set the value of the signal - * - * It recommend use `set` for primitive values - * - * @param value - */ - set(value: T): void; - /** - * Update the value of the signal using an updater function - * - * It recommend use `update` for non-primitive values, only the first level of the object will be reactive. - * - * @param updater - */ - update(updater: Updater): void; - /** - * Mutate the value of the signal using a mutator function - * - * this action will call `triggerRef`, so the value will be tracked on `watchEffect`. - * - * It recommend use `mutate` for non-primitive values, all levels of the object will be reactive. - * - * @param mutator - */ - mutate(mutator: Mutator): void; - /** - * Get the reference of the signal - * - * Sometimes it can be useful to make `v-model` work with the signal - * - * ```vue - * ; - * - * - * ``` - */ - getRef(): Readonly>>; -} - -export interface ReadonlySignal { - (): Readonly; -} - -export interface SignalOptions { - /** - * Whether to use `ref` to store the value - * - * @default false use `sharedRef` to store the value - */ - useRef?: boolean; -} - -export function useSignal(initialValue: T, options?: SignalOptions): Signal { - const { useRef } = options || {}; - - const state = useRef ? (ref(initialValue) as Ref) : shallowRef(initialValue); - - return createSignal(state); -} - -export function useComputed(getter: ComputedGetter, debugOptions?: DebuggerOptions): ReadonlySignal; -export function useComputed(options: WritableComputedOptions, debugOptions?: DebuggerOptions): Signal; -export function useComputed( - getterOrOptions: ComputedGetter | WritableComputedOptions, - debugOptions?: DebuggerOptions -) { - const isGetter = typeof getterOrOptions === 'function'; - - const computedValue = computed(getterOrOptions as any, debugOptions); - - if (isGetter) { - return () => computedValue.value as ReadonlySignal; - } - - return createSignal(computedValue); -} - -function createSignal(state: ShallowRef | WritableComputedRef): Signal { - const signal = () => state.value; - - signal.set = (value: T) => { - state.value = value; - }; - - signal.update = (updater: Updater) => { - state.value = updater(state.value); - }; - - signal.mutate = (mutator: Mutator) => { - mutator(state.value); - triggerRef(state); - }; - - signal.getRef = () => state as Readonly>>; - - return signal; -} diff --git a/packages/hooks/src/use-table.ts b/packages/hooks/src/use-table.ts index 14d08c92..5b038525 100644 --- a/packages/hooks/src/use-table.ts +++ b/packages/hooks/src/use-table.ts @@ -1,12 +1,20 @@ -import { computed, reactive, ref } from 'vue'; +import { computed, ref } from 'vue'; import type { Ref, VNodeChild } from 'vue'; -import { jsonClone } from '@sa/utils'; import useBoolean from './use-boolean'; import useLoading from './use-loading'; -export type MaybePromise = T | Promise; +export interface PaginationData { + data: T[]; + pageNum: number; + pageSize: number; + total: number; +} -export type ApiFn = (args: any) => Promise; +type GetApiData = Pagination extends true ? PaginationData : ApiData[]; + +type Transform = ( + response: ResponseData +) => GetApiData; export type TableColumnCheckTitle = string | ((...args: any) => VNodeChild); @@ -14,74 +22,64 @@ export type TableColumnCheck = { key: string; title: TableColumnCheckTitle; checked: boolean; + visible: boolean; }; -export type TableDataWithIndex = T & { index: number }; - -export type TransformedData = { - data: TableDataWithIndex[]; - total?: number; -}; - -export type Transformer = (response: Response) => TransformedData; - -export type TableConfig = { - /** api function to get table data */ - apiFn: A; - /** api params */ - apiParams?: Parameters[0]; - /** transform api response to table data */ - transformer: Transformer>>; - /** columns factory */ - columns: () => C[]; +export interface UseTableOptions { + /** + * api function to get table data + */ + api: () => Promise; + /** + * whether to enable pagination + */ + pagination?: Pagination; + /** + * transform api response to table data + */ + transform: Transform; + /** + * columns factory + */ + columns: () => Column[]; /** * get column checks - * - * @param columns */ - getColumnChecks: (columns: C[]) => TableColumnCheck[]; + getColumnChecks: (columns: Column[]) => TableColumnCheck[]; /** * get columns - * - * @param columns */ - getColumns: (columns: C[], checks: TableColumnCheck[]) => C[]; + getColumns: (columns: Column[], checks: TableColumnCheck[]) => Column[]; /** * callback when response fetched - * - * @param transformed transformed data */ - onFetched?: (transformed: TransformedData) => MaybePromise; + onFetched?: (data: GetApiData) => void | Promise; /** * whether to get data immediately * * @default true */ immediate?: boolean; -}; +} -export default function useHookTable(config: TableConfig) { +export default function useTable( + options: UseTableOptions +) { const { loading, startLoading, endLoading } = useLoading(); const { bool: empty, setBool: setEmpty } = useBoolean(); - const { apiFn, apiParams, transformer, immediate = true, getColumnChecks, getColumns } = config; + const { api, pagination, transform, columns, getColumnChecks, getColumns, onFetched, immediate = true } = options; - const searchParams: NonNullable[0]> = reactive(jsonClone({ ...apiParams })); + const data = ref([]) as Ref; - const allColumns = ref(config.columns()) as Ref; + const columnChecks = ref(getColumnChecks(columns())) as Ref; - const data: Ref[]> = ref([]); - - const columnChecks: Ref = ref(getColumnChecks(config.columns())); - - const columns = computed(() => getColumns(allColumns.value, columnChecks.value)); + const $columns = computed(() => getColumns(columns(), columnChecks.value)); function reloadColumns() { - allColumns.value = config.columns(); - const checkMap = new Map(columnChecks.value.map(col => [col.key, col.checked])); - const defaultChecks = getColumnChecks(allColumns.value); + const defaultChecks = getColumnChecks(columns()); columnChecks.value = defaultChecks.map(col => ({ ...col, @@ -90,48 +88,21 @@ export default function useHookTable(config: TableConfig< } async function getData() { - startLoading(); + try { + startLoading(); - const formattedParams = formatSearchParams(searchParams); + const response = await api(); - const response = await apiFn(formattedParams); + const transformed = transform(response); - const transformed = transformer(response as Awaited>); + data.value = getTableData(transformed, pagination); - data.value = transformed.data; + setEmpty(data.value.length === 0); - setEmpty(transformed.data.length === 0); - - await config.onFetched?.(transformed); - - endLoading(); - } - - function formatSearchParams(params: Record) { - const formattedParams: Record = {}; - - Object.entries(params).forEach(([key, value]) => { - if (value !== null && value !== undefined) { - formattedParams[key] = value; - } - }); - - return formattedParams; - } - - /** - * update search params - * - * @param params - */ - function updateSearchParams(params: Partial[0]>) { - Object.assign(searchParams, params); - } - - /** reset search params */ - function resetSearchParams() { - Object.assign(searchParams, jsonClone(apiParams)); - getData(); + await onFetched?.(transformed); + } finally { + endLoading(); + } } if (immediate) { @@ -142,12 +113,20 @@ export default function useHookTable(config: TableConfig< loading, empty, data, - columns, + columns: $columns, columnChecks, reloadColumns, - getData, - searchParams, - updateSearchParams, - resetSearchParams + getData }; } + +function getTableData( + data: GetApiData, + pagination?: Pagination +) { + if (pagination) { + return (data as PaginationData).data; + } + + return data as ApiData[]; +} diff --git a/packages/materials/src/libs/admin-layout/index.vue b/packages/materials/src/libs/admin-layout/index.vue index 543f7dc0..8bbc5526 100644 --- a/packages/materials/src/libs/admin-layout/index.vue +++ b/packages/materials/src/libs/admin-layout/index.vue @@ -127,7 +127,6 @@ function handleClickMask() { :class="[ style['layout-header'], commonClass, - headerClass, headerLeftGapClass, { 'absolute top-0 left-0 w-full': fixedHeaderAndTab } ]" diff --git a/packages/materials/src/types/index.ts b/packages/materials/src/types/index.ts index bbcfb9d6..583f0907 100644 --- a/packages/materials/src/types/index.ts +++ b/packages/materials/src/types/index.ts @@ -6,12 +6,6 @@ interface AdminLayoutHeaderConfig { * @default true */ headerVisible?: boolean; - /** - * Header class - * - * @default '' - */ - headerClass?: string; /** * Header height * diff --git a/packages/ofetch/package.json b/packages/ofetch/package.json deleted file mode 100644 index 75929324..00000000 --- a/packages/ofetch/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "@sa/fetch", - "version": "1.3.15", - "exports": { - ".": "./src/index.ts" - }, - "typesVersions": { - "*": { - "*": ["./src/*"] - } - }, - "dependencies": { - "ofetch": "1.4.1" - } -} diff --git a/packages/ofetch/src/index.ts b/packages/ofetch/src/index.ts deleted file mode 100644 index dce1ed44..00000000 --- a/packages/ofetch/src/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { ofetch } from 'ofetch'; -import type { FetchOptions } from 'ofetch'; - -export function createRequest(options: FetchOptions) { - const request = ofetch.create(options); - - return request; -} - -export default createRequest; diff --git a/packages/ofetch/tsconfig.json b/packages/ofetch/tsconfig.json deleted file mode 100644 index 5823ed54..00000000 --- a/packages/ofetch/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "jsx": "preserve", - "lib": ["DOM", "ESNext"], - "baseUrl": ".", - "module": "ESNext", - "moduleResolution": "node", - "resolveJsonModule": true, - "types": ["node"], - "strict": true, - "strictNullChecks": true, - "noUnusedLocals": true, - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true - }, - "include": ["src/**/*"], - "exclude": ["node_modules", "dist"] -} diff --git a/packages/scripts/package.json b/packages/scripts/package.json index 08194cae..4c0be151 100644 --- a/packages/scripts/package.json +++ b/packages/scripts/package.json @@ -15,7 +15,7 @@ "devDependencies": { "@soybeanjs/changelog": "0.3.24", "bumpp": "10.2.0", - "c12": "3.0.4", + "c12": "3.1.0", "cac": "6.7.14", "consola": "3.4.2", "enquirer": "2.4.1", diff --git a/packages/utils/src/storage.ts b/packages/utils/src/storage.ts index 850562ab..e4aad14a 100644 --- a/packages/utils/src/storage.ts +++ b/packages/utils/src/storage.ts @@ -32,7 +32,8 @@ export function createStorage(type: StorageType, storagePrefix storageData = JSON.parse(json); } catch {} - if (storageData) { + // storageData may be `false` if it is boolean type + if (storageData !== null) { return storageData as T[K]; } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bf55d46a..9f0c4d61 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -87,8 +87,8 @@ importers: specifier: 0.6.0 version: 0.6.0(@types/sortablejs@1.15.8) vue-i18n: - specifier: 11.1.9 - version: 11.1.9(vue@3.5.17(typescript@5.8.3)) + specifier: 11.1.10 + version: 11.1.10(vue@3.5.17(typescript@5.8.3)) vue-router: specifier: 4.5.1 version: 4.5.1(vue@3.5.17(typescript@5.8.3)) @@ -97,8 +97,8 @@ importers: specifier: 0.3.8 version: 0.3.8 '@iconify/json': - specifier: 2.2.357 - version: 2.2.357 + specifier: 2.2.359 + version: 2.2.359 '@sa/scripts': specifier: workspace:* version: link:packages/scripts @@ -109,8 +109,8 @@ importers: specifier: 1.7.1 version: 1.7.1(@typescript-eslint/utils@8.37.0(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3))(@unocss/eslint-config@66.3.3(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3))(eslint-plugin-vue@10.3.0(@typescript-eslint/parser@8.35.1(eslint@9.31.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.31.0(jiti@2.4.2))(vue-eslint-parser@10.2.0(eslint@9.31.0(jiti@2.4.2))))(eslint@9.31.0(jiti@2.4.2))(svelte-eslint-parser@1.3.0)(typescript@5.8.3)(vue-eslint-parser@10.2.0(eslint@9.31.0(jiti@2.4.2))) '@types/node': - specifier: 24.0.13 - version: 24.0.13 + specifier: 24.0.15 + version: 24.0.15 '@types/nprogress': specifier: 0.2.3 version: 0.2.3 @@ -131,13 +131,13 @@ importers: version: 66.3.3 '@unocss/vite': specifier: 66.3.3 - version: 66.3.3(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3)) + version: 66.3.3(vite@7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3)) '@vitejs/plugin-vue': specifier: 6.0.0 - version: 6.0.0(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3)) + version: 6.0.0(vite@7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3)) '@vitejs/plugin-vue-jsx': specifier: 5.0.1 - version: 5.0.1(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3)) + version: 5.0.1(vite@7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3)) consola: specifier: 3.4.2 version: 3.4.2 @@ -169,29 +169,29 @@ importers: specifier: 28.8.0 version: 28.8.0(@babel/parser@7.28.0)(vue@3.5.17(typescript@5.8.3)) vite: - specifier: 7.0.4 - version: 7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0) + specifier: 7.0.5 + version: 7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0) vite-plugin-monaco-editor: specifier: ^1.1.0 version: 1.1.0(monaco-editor@0.52.2) vite-plugin-progress: specifier: 0.0.7 - version: 0.0.7(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0)) + version: 0.0.7(vite@7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0)) vite-plugin-static-copy: specifier: ^3.1.0 - version: 3.1.1(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0)) + version: 3.1.1(vite@7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0)) vite-plugin-svg-icons: specifier: 2.0.1 - version: 2.0.1(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0)) + version: 2.0.1(vite@7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0)) vite-plugin-vue-devtools: specifier: 7.7.7 - version: 7.7.7(rollup@4.45.1)(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3)) + version: 7.7.7(rollup@4.45.1)(vite@7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3)) vue-eslint-parser: specifier: 10.2.0 version: 10.2.0(eslint@9.31.0(jiti@2.4.2)) vue-tsc: - specifier: 3.0.1 - version: 3.0.1(typescript@5.8.3) + specifier: 3.0.3 + version: 3.0.3(typescript@5.8.3) packages/alova: dependencies: @@ -255,12 +255,6 @@ importers: specifier: 0.9.1 version: 0.9.1 - packages/ofetch: - dependencies: - ofetch: - specifier: 1.4.1 - version: 1.4.1 - packages/scripts: devDependencies: '@soybeanjs/changelog': @@ -270,8 +264,8 @@ importers: specifier: 10.2.0 version: 10.2.0 c12: - specifier: 3.0.4 - version: 3.0.4 + specifier: 3.1.0 + version: 3.1.0 cac: specifier: 6.7.14 version: 6.7.14 @@ -764,8 +758,8 @@ packages: resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==} engines: {node: '>=18.18'} - '@iconify/json@2.2.357': - resolution: {integrity: sha512-v8fr/KwcJ0qsoEJ69k1+M928bfzNmmApyJBTIAwwIzHZrVEUneHTEOJRy7OVYKisauBMVVH067I2uFNoPA92iA==} + '@iconify/json@2.2.359': + resolution: {integrity: sha512-nOIaROD3xeLiFGvJu0YIgeu4Hqbmz6T71b0lsFv1TY6Uu6Lk/5Z8GhDByIE2/zfgxvxfv3f+5A/DkLHmMXYu8Q==} '@iconify/types@2.0.0': resolution: {integrity: sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==} @@ -778,16 +772,16 @@ packages: peerDependencies: vue: '>=3' - '@intlify/core-base@11.1.9': - resolution: {integrity: sha512-Lrdi4wp3XnGhWmB/mMD/XtfGUw1Jt+PGpZI/M63X1ZqhTDjNHRVCs/i8vv8U1cwaj1A9fb0bkCQHLSL0SK+pIQ==} + '@intlify/core-base@11.1.10': + resolution: {integrity: sha512-JhRb40hD93Vk0BgMgDc/xMIFtdXPHoytzeK6VafBNOj6bb6oUZrGamXkBKecMsmGvDQQaPRGG2zpa25VCw8pyw==} engines: {node: '>= 16'} - '@intlify/message-compiler@11.1.9': - resolution: {integrity: sha512-84SNs3Ikjg0rD1bOuchzb3iK1vR2/8nxrkyccIl5DjFTeMzE/Fxv6X+A7RN5ZXjEWelc1p5D4kHA6HEOhlKL5Q==} + '@intlify/message-compiler@11.1.10': + resolution: {integrity: sha512-TABl3c8tSLWbcD+jkQTyBhrnW251dzqW39MPgEUCsd69Ua3ceoimsbIzvkcPzzZvt1QDxNkenMht+5//V3JvLQ==} engines: {node: '>= 16'} - '@intlify/shared@11.1.9': - resolution: {integrity: sha512-H/83xgU1l8ox+qG305p6ucmoy93qyjIPnvxGWRA7YdOoHe1tIiW9IlEu4lTdsOR7cfP1ecrwyflQSqXdXBacXA==} + '@intlify/shared@11.1.10': + resolution: {integrity: sha512-6ZW/f3Zzjxfa1Wh0tYQI5pLKUtU+SY7l70pEG+0yd0zjcsYcK0EBt6Fz30Dy0tZhEqemziQQy2aNU3GJzyrMUA==} engines: {node: '>= 16'} '@isaacs/balanced-match@4.0.1': @@ -1160,8 +1154,8 @@ packages: '@types/node@10.17.60': resolution: {integrity: sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==} - '@types/node@24.0.13': - resolution: {integrity: sha512-Qm9OYVOFHFYg3wJoTSrz80hoec5Lia/dPp84do3X7dZvLikQvM1YpmvTBEdIr/e+U8HTkFjLHLnl78K/qjf+jQ==} + '@types/node@24.0.15': + resolution: {integrity: sha512-oaeTSbCef7U/z7rDeJA138xpG3NuKc64/rZ2qmUFkFJmnMsAPaluIifqyWd8hSSMxyP9oie3dLAqYPblag9KgA==} '@types/nprogress@0.2.3': resolution: {integrity: sha512-k7kRA033QNtC+gLc4VPlfnue58CM1iQLgn1IMAU8VPHGOj7oIHPp9UlhedEnD/Gl8evoCjwkZjlBORtZ3JByUA==} @@ -1442,14 +1436,14 @@ packages: vite: ^5.0.0 || ^6.0.0 || ^7.0.0 vue: ^3.2.25 - '@volar/language-core@2.4.17': - resolution: {integrity: sha512-chmRZMbKmcGpKMoO7Reb70uiLrzo0KWC2CkFttKUuKvrE+VYgi+fL9vWMJ07Fv5ulX0V1TAyyacN9q3nc5/ecA==} + '@volar/language-core@2.4.20': + resolution: {integrity: sha512-dRDF1G33xaAIDqR6+mXUIjXYdu9vzSxlMGfMEwBxQsfY/JMUEXSpLTR057oTKlUQ2nIvCmP9k94A8h8z2VrNSA==} - '@volar/source-map@2.4.17': - resolution: {integrity: sha512-QDybtQyO3Ms/NjFqNHTC5tbDN2oK5VH7ZaKrcubtfHBDj63n2pizHC3wlMQ+iT55kQXZUUAbmBX5L1C8CHFeBw==} + '@volar/source-map@2.4.20': + resolution: {integrity: sha512-mVjmFQH8mC+nUaVwmbxoYUy8cww+abaO8dWzqPUjilsavjxH0jCJ3Mp8HFuHsdewZs2c+SP+EO7hCd8Z92whJg==} - '@volar/typescript@2.4.17': - resolution: {integrity: sha512-3paEFNh4P5DkgNUB2YkTRrfUekN4brAXxd3Ow1syMqdIPtCZHbUy4AW99S5RO/7mzyTWPMdDSo3mqTpB/LPObQ==} + '@volar/typescript@2.4.20': + resolution: {integrity: sha512-Oc4DczPwQyXcVbd+5RsNEqX6ia0+w3p+klwdZQ6ZKhFjWoBP9PCPQYlKYRi/tDemWphW93P/Vv13vcE9I9D2GQ==} '@vue/babel-helper-vue-transform-on@1.4.0': resolution: {integrity: sha512-mCokbouEQ/ocRce/FpKCRItGo+013tHg7tixg3DUNS+6bmIchPt66012kBMm476vyEIJPafrvOf4E5OYj3shSw==} @@ -1499,8 +1493,8 @@ packages: '@vue/devtools-shared@7.7.7': resolution: {integrity: sha512-+udSj47aRl5aKb0memBvcUG9koarqnxNM5yjuREvqwK6T3ap4mn3Zqqc17QrBFTqSMjr3HK1cvStEZpMDpfdyw==} - '@vue/language-core@3.0.1': - resolution: {integrity: sha512-sq+/Mc1IqIexWEQ+Q2XPiDb5SxSvY5JPqHnMOl/PlF5BekslzduX8dglSkpC17VeiAQB6dpS+4aiwNLJRduCNw==} + '@vue/language-core@3.0.3': + resolution: {integrity: sha512-I9wY0ULMN9tMSua+2C7g+ez1cIziVMUzIHlDYGSl2rtru3Eh4sXj95vZ+4GBuXwwPnEmYfzSApVbXiVbI8V5Gg==} peerDependencies: typescript: '*' peerDependenciesMeta: @@ -1713,8 +1707,8 @@ packages: resolution: {integrity: sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==} engines: {node: '>=18'} - c12@3.0.4: - resolution: {integrity: sha512-t5FaZTYbbCtvxuZq9xxIruYydrAGsJ+8UdP0pZzMiK2xl/gNiSOy0OxhLzHUEEb0m1QXYqfzfvyIFEmz/g9lqg==} + c12@3.1.0: + resolution: {integrity: sha512-uWoS8OU1MEIsOv8p/5a82c3H31LsWVR5qiyXVfBNOzfffjUWtPnhAb4BYI2uG2HfGmZmFjCtui5XNWaps+iFuw==} peerDependencies: magicast: ^0.3.5 peerDependenciesMeta: @@ -4025,8 +4019,8 @@ packages: peerDependencies: vite: ^3.0.0-0 || ^4.0.0-0 || ^5.0.0-0 || ^6.0.0-0 || ^7.0.0-0 - vite@7.0.4: - resolution: {integrity: sha512-SkaSguuS7nnmV7mfJ8l81JGBFV7Gvzp8IzgE8A8t23+AxuNX61Q5H1Tpz5efduSN7NHC8nQXD3sKQKZAu5mNEA==} + vite@7.0.5: + resolution: {integrity: sha512-1mncVwJxy2C9ThLwz0+2GKZyEXuC3MyWtAAlNftlZZXZDP3AJt5FmwcMit/IGGaNZ8ZOB2BNO/HFUB+CpN0NQw==} engines: {node: ^20.19.0 || >=22.12.0} hasBin: true peerDependencies: @@ -4110,8 +4104,8 @@ packages: peerDependencies: vue: ^3.4.37 - vue-i18n@11.1.9: - resolution: {integrity: sha512-N9ZTsXdRmX38AwS9F6Rh93RtPkvZTkSy/zNv63FTIwZCUbLwwrpqlKz9YQuzFLdlvRdZTnWAUE5jMxr8exdl7g==} + vue-i18n@11.1.10: + resolution: {integrity: sha512-C+IwnSg8QDSOAox0gdFYP5tsKLx5jNWxiawNoiNB/Tw4CReXmM1VJMXbduhbrEzAFLhreqzfDocuSVjGbxQrag==} engines: {node: '>= 16'} peerDependencies: vue: ^3.0.0 @@ -4121,8 +4115,8 @@ packages: peerDependencies: vue: ^3.2.0 - vue-tsc@3.0.1: - resolution: {integrity: sha512-UvMLQD0hAGL1g/NfEQelnSVB4H5gtf/gz2lJKjMMwWNOUmSNyWkejwJagAxEbSjtV5CPPJYslOtoSuqJ63mhdg==} + vue-tsc@3.0.3: + resolution: {integrity: sha512-uU1OMSzWE8/y0+kDTc0iEIu9v82bmFkGyJpAO/x3wQqBkkHkButKgtygREyOkxL4E/xtcf/ExvgNhhjdzonldw==} hasBin: true peerDependencies: typescript: '>=5.0.0' @@ -4636,7 +4630,7 @@ snapshots: '@humanwhocodes/retry@0.4.3': {} - '@iconify/json@2.2.357': + '@iconify/json@2.2.359': dependencies: '@iconify/types': 2.0.0 pathe: 1.1.2 @@ -4661,17 +4655,17 @@ snapshots: '@iconify/types': 2.0.0 vue: 3.5.17(typescript@5.8.3) - '@intlify/core-base@11.1.9': + '@intlify/core-base@11.1.10': dependencies: - '@intlify/message-compiler': 11.1.9 - '@intlify/shared': 11.1.9 + '@intlify/message-compiler': 11.1.10 + '@intlify/shared': 11.1.10 - '@intlify/message-compiler@11.1.9': + '@intlify/message-compiler@11.1.10': dependencies: - '@intlify/shared': 11.1.9 + '@intlify/shared': 11.1.10 source-map-js: 1.2.1 - '@intlify/shared@11.1.9': {} + '@intlify/shared@11.1.10': {} '@isaacs/balanced-match@4.0.1': {} @@ -4965,7 +4959,7 @@ snapshots: '@types/node@10.17.60': {} - '@types/node@24.0.13': + '@types/node@24.0.15': dependencies: undici-types: 7.8.0 @@ -4979,7 +4973,7 @@ snapshots: '@types/svgo@2.6.4': dependencies: - '@types/node': 24.0.13 + '@types/node': 24.0.15 '@types/web-bluetooth@0.0.21': {} @@ -5210,7 +5204,7 @@ snapshots: dependencies: '@unocss/core': 66.3.3 - '@unocss/vite@66.3.3(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3))': + '@unocss/vite@66.3.3(vite@7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3))': dependencies: '@ampproject/remapping': 2.3.0 '@unocss/config': 66.3.3 @@ -5221,7 +5215,7 @@ snapshots: pathe: 2.0.3 tinyglobby: 0.2.14 unplugin-utils: 0.2.4 - vite: 7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0) + vite: 7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0) transitivePeerDependencies: - vue @@ -5284,32 +5278,32 @@ snapshots: '@unrs/resolver-binding-win32-x64-msvc@1.11.1': optional: true - '@vitejs/plugin-vue-jsx@5.0.1(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3))': + '@vitejs/plugin-vue-jsx@5.0.1(vite@7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3))': dependencies: '@babel/core': 7.28.0 '@babel/plugin-transform-typescript': 7.28.0(@babel/core@7.28.0) '@rolldown/pluginutils': 1.0.0-beta.27 '@vue/babel-plugin-jsx': 1.4.0(@babel/core@7.28.0) - vite: 7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0) + vite: 7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0) vue: 3.5.17(typescript@5.8.3) transitivePeerDependencies: - supports-color - '@vitejs/plugin-vue@6.0.0(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3))': + '@vitejs/plugin-vue@6.0.0(vite@7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3))': dependencies: '@rolldown/pluginutils': 1.0.0-beta.19 - vite: 7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0) + vite: 7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0) vue: 3.5.17(typescript@5.8.3) - '@volar/language-core@2.4.17': + '@volar/language-core@2.4.20': dependencies: - '@volar/source-map': 2.4.17 + '@volar/source-map': 2.4.20 - '@volar/source-map@2.4.17': {} + '@volar/source-map@2.4.20': {} - '@volar/typescript@2.4.17': + '@volar/typescript@2.4.20': dependencies: - '@volar/language-core': 2.4.17 + '@volar/language-core': 2.4.20 path-browserify: 1.0.1 vscode-uri: 3.1.0 @@ -5383,14 +5377,14 @@ snapshots: dependencies: '@vue/devtools-kit': 7.7.7 - '@vue/devtools-core@7.7.7(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3))': + '@vue/devtools-core@7.7.7(vite@7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3))': dependencies: '@vue/devtools-kit': 7.7.7 '@vue/devtools-shared': 7.7.7 mitt: 3.0.1 nanoid: 5.1.5 pathe: 2.0.3 - vite-hot-client: 2.1.0(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0)) + vite-hot-client: 2.1.0(vite@7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0)) vue: 3.5.17(typescript@5.8.3) transitivePeerDependencies: - vite @@ -5409,16 +5403,16 @@ snapshots: dependencies: rfdc: 1.4.1 - '@vue/language-core@3.0.1(typescript@5.8.3)': + '@vue/language-core@3.0.3(typescript@5.8.3)': dependencies: - '@volar/language-core': 2.4.17 + '@volar/language-core': 2.4.20 '@vue/compiler-dom': 3.5.17 '@vue/compiler-vue2': 2.7.16 '@vue/shared': 3.5.17 alien-signals: 2.0.5 - minimatch: 10.0.3 muggle-string: 0.4.1 path-browserify: 1.0.1 + picomatch: 4.0.3 optionalDependencies: typescript: 5.8.3 @@ -5623,7 +5617,7 @@ snapshots: dependencies: ansis: 4.1.0 args-tokenizer: 0.3.0 - c12: 3.0.4 + c12: 3.1.0 cac: 6.7.14 escalade: 3.2.0 jsonc-parser: 3.3.1 @@ -5639,7 +5633,7 @@ snapshots: dependencies: run-applescript: 7.0.0 - c12@3.0.4: + c12@3.1.0: dependencies: chokidar: 4.0.3 confbox: 0.2.2 @@ -8136,11 +8130,11 @@ snapshots: evtd: 0.2.4 vue: 3.5.17(typescript@5.8.3) - vite-hot-client@2.1.0(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0)): + vite-hot-client@2.1.0(vite@7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0)): dependencies: - vite: 7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0) + vite: 7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0) - vite-plugin-inspect@0.8.9(rollup@4.45.1)(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0)): + vite-plugin-inspect@0.8.9(rollup@4.45.1)(vite@7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0)): dependencies: '@antfu/utils': 0.7.10 '@rollup/pluginutils': 5.2.0(rollup@4.45.1) @@ -8151,7 +8145,7 @@ snapshots: perfect-debounce: 1.0.0 picocolors: 1.1.1 sirv: 3.0.1 - vite: 7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0) + vite: 7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0) transitivePeerDependencies: - rollup - supports-color @@ -8160,23 +8154,23 @@ snapshots: dependencies: monaco-editor: 0.52.2 - vite-plugin-progress@0.0.7(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0)): + vite-plugin-progress@0.0.7(vite@7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0)): dependencies: picocolors: 1.1.1 progress: 2.0.3 rd: 2.0.1 - vite: 7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0) + vite: 7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0) - vite-plugin-static-copy@3.1.1(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0)): + vite-plugin-static-copy@3.1.1(vite@7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0)): dependencies: chokidar: 3.6.0 fs-extra: 11.3.0 p-map: 7.0.3 picocolors: 1.1.1 tinyglobby: 0.2.14 - vite: 7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0) + vite: 7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0) - vite-plugin-svg-icons@2.0.1(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0)): + vite-plugin-svg-icons@2.0.1(vite@7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0)): dependencies: '@types/svgo': 2.6.4 cors: 2.8.5 @@ -8186,27 +8180,27 @@ snapshots: pathe: 0.2.0 svg-baker: 1.7.0 svgo: 2.8.0 - vite: 7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0) + vite: 7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0) transitivePeerDependencies: - supports-color - vite-plugin-vue-devtools@7.7.7(rollup@4.45.1)(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3)): + vite-plugin-vue-devtools@7.7.7(rollup@4.45.1)(vite@7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3)): dependencies: - '@vue/devtools-core': 7.7.7(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3)) + '@vue/devtools-core': 7.7.7(vite@7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0))(vue@3.5.17(typescript@5.8.3)) '@vue/devtools-kit': 7.7.7 '@vue/devtools-shared': 7.7.7 execa: 9.6.0 sirv: 3.0.1 - vite: 7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0) - vite-plugin-inspect: 0.8.9(rollup@4.45.1)(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0)) - vite-plugin-vue-inspector: 5.3.2(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0)) + vite: 7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0) + vite-plugin-inspect: 0.8.9(rollup@4.45.1)(vite@7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0)) + vite-plugin-vue-inspector: 5.3.2(vite@7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0)) transitivePeerDependencies: - '@nuxt/kit' - rollup - supports-color - vue - vite-plugin-vue-inspector@5.3.2(vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0)): + vite-plugin-vue-inspector@5.3.2(vite@7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0)): dependencies: '@babel/core': 7.28.0 '@babel/plugin-proposal-decorators': 7.28.0(@babel/core@7.28.0) @@ -8217,11 +8211,11 @@ snapshots: '@vue/compiler-dom': 3.5.17 kolorist: 1.8.0 magic-string: 0.30.17 - vite: 7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0) + vite: 7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0) transitivePeerDependencies: - supports-color - vite@7.0.4(@types/node@24.0.13)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0): + vite@7.0.5(@types/node@24.0.15)(jiti@2.4.2)(sass@1.89.2)(tsx@4.20.3)(yaml@2.8.0): dependencies: esbuild: 0.25.6 fdir: 6.4.6(picomatch@4.0.3) @@ -8230,7 +8224,7 @@ snapshots: rollup: 4.45.1 tinyglobby: 0.2.14 optionalDependencies: - '@types/node': 24.0.13 + '@types/node': 24.0.15 fsevents: 2.3.3 jiti: 2.4.2 sass: 1.89.2 @@ -8275,10 +8269,10 @@ snapshots: dependencies: vue: 3.5.17(typescript@5.8.3) - vue-i18n@11.1.9(vue@3.5.17(typescript@5.8.3)): + vue-i18n@11.1.10(vue@3.5.17(typescript@5.8.3)): dependencies: - '@intlify/core-base': 11.1.9 - '@intlify/shared': 11.1.9 + '@intlify/core-base': 11.1.10 + '@intlify/shared': 11.1.10 '@vue/devtools-api': 6.6.4 vue: 3.5.17(typescript@5.8.3) @@ -8287,10 +8281,10 @@ snapshots: '@vue/devtools-api': 6.6.4 vue: 3.5.17(typescript@5.8.3) - vue-tsc@3.0.1(typescript@5.8.3): + vue-tsc@3.0.3(typescript@5.8.3): dependencies: - '@volar/typescript': 2.4.17 - '@vue/language-core': 3.0.1(typescript@5.8.3) + '@volar/typescript': 2.4.20 + '@vue/language-core': 3.0.3(typescript@5.8.3) typescript: 5.8.3 vue@3.5.17(typescript@5.8.3): diff --git a/src/App.vue b/src/App.vue index ce819c3c..eb499a26 100644 --- a/src/App.vue +++ b/src/App.vue @@ -4,7 +4,6 @@ import { NConfigProvider, darkTheme } from 'naive-ui'; import type { WatermarkProps } from 'naive-ui'; import { useAppStore } from './store/modules/app'; import { useThemeStore } from './store/modules/theme'; -import { useAuthStore } from './store/modules/auth'; import { naiveDateLocales, naiveLocales } from './locales/naive'; defineOptions({ @@ -13,7 +12,6 @@ defineOptions({ const appStore = useAppStore(); const themeStore = useThemeStore(); -const { userInfo } = useAuthStore(); const naiveDarkTheme = computed(() => (themeStore.darkMode ? darkTheme : undefined)); @@ -26,24 +24,19 @@ const naiveDateLocale = computed(() => { }); const watermarkProps = computed(() => { - const appTitle = import.meta.env.VITE_APP_TITLE || 'RuoYi-Vue-Plus'; - const content = - themeStore.watermark.enableUserName && userInfo.user?.userName - ? `${userInfo.user?.nickName}@${appTitle} ${userInfo.user?.userName}` - : appTitle; return { - content, + content: themeStore.watermarkContent, cross: true, fullscreen: true, fontSize: 14, - fontColor: themeStore.darkMode ? 'rgba(200, 200, 200, 0.03)' : 'rgba(200, 200, 200, 0.2)', lineHeight: 14, - width: 200, - height: 300, + width: 384, + height: 384, xOffset: 12, yOffset: 60, - rotate: -18, - zIndex: 9999 + rotate: -13, + zIndex: 9999, + fontColor: themeStore.darkMode ? 'rgba(200, 200, 200, 0.03)' : 'rgba(200, 200, 200, 0.2)' }; }); diff --git a/src/components/advanced/table-column-setting.vue b/src/components/advanced/table-column-setting.vue index 014a51ae..10bd35ad 100644 --- a/src/components/advanced/table-column-setting.vue +++ b/src/components/advanced/table-column-setting.vue @@ -22,7 +22,12 @@ const columns = defineModel('columns', { -
+