diff --git a/src/_utils/index.ts b/src/_utils/index.ts index 5a775b7f8..5b5986dd2 100644 --- a/src/_utils/index.ts +++ b/src/_utils/index.ts @@ -11,6 +11,7 @@ export { } from './vue' export type { MaybeArray } from './vue' export { warn, warnOnce, throwError, smallerSize, largerSize } from './naive' +export type { ExtractPublicPropTypes } from './naive' export { formatLength } from './css' export { createKey } from './cssr' export * from './composable' diff --git a/src/_utils/naive/extract-public-props.ts b/src/_utils/naive/extract-public-props.ts new file mode 100644 index 000000000..148c6cf21 --- /dev/null +++ b/src/_utils/naive/extract-public-props.ts @@ -0,0 +1,9 @@ +import { ExtractPropTypes } from '@vue/runtime-core' +import { useTheme } from '../../_mixins' + +type themePropKeys = keyof typeof useTheme.props + +export type ExtractPublicPropTypes = Omit< +Partial>, +themePropKeys +> diff --git a/src/_utils/naive/index.ts b/src/_utils/naive/index.ts index 9c7f17bf4..a21f3a295 100644 --- a/src/_utils/naive/index.ts +++ b/src/_utils/naive/index.ts @@ -1,2 +1,3 @@ export { warn, warnOnce, throwError } from './warn' export { smallerSize, largerSize } from './prop' +export type { ExtractPublicPropTypes } from './extract-public-props' diff --git a/src/affix/src/Affix.tsx b/src/affix/src/Affix.tsx index 67d08790a..caa1ccb54 100644 --- a/src/affix/src/Affix.tsx +++ b/src/affix/src/Affix.tsx @@ -6,12 +6,12 @@ import { defineComponent, CSSProperties, PropType, - h, - ExtractPropTypes + h } from 'vue' import { getScrollParent, unwrapElement } from 'seemly' import { useConfig, useStyle } from '../../_mixins' import { warn, keysOf } from '../../_utils' +import type { ExtractPublicPropTypes } from '../../_utils' import style from './styles/index.cssr' export const affixProps = { @@ -54,7 +54,7 @@ export const affixProps = { export const affixPropKeys = keysOf(affixProps) -export type AffixProps = Partial> +export type AffixProps = ExtractPublicPropTypes export default defineComponent({ name: 'Affix', diff --git a/src/alert/src/Alert.tsx b/src/alert/src/Alert.tsx index b354a5cc0..5776724f1 100644 --- a/src/alert/src/Alert.tsx +++ b/src/alert/src/Alert.tsx @@ -5,8 +5,7 @@ import { defineComponent, PropType, mergeProps, - renderSlot, - ExtractPropTypes + renderSlot } from 'vue' import { getMargin } from 'seemly' import { @@ -19,6 +18,7 @@ import { NFadeInExpandTransition, NBaseClose, NBaseIcon } from '../../_internal' import { useConfig, useTheme } from '../../_mixins' import type { ThemeProps } from '../../_mixins' import { warn, createKey } from '../../_utils' +import type { ExtractPublicPropTypes } from '../../_utils' import { alertLight } from '../styles' import type { AlertTheme } from '../styles' import style from './styles/index.cssr' @@ -63,7 +63,7 @@ const alertProps = { } } -export type AlertProps = Partial> +export type AlertProps = ExtractPublicPropTypes export default defineComponent({ name: 'Alert', diff --git a/src/anchor/src/AnchorAdapter.tsx b/src/anchor/src/AnchorAdapter.tsx index ee9f2bb8a..390933319 100644 --- a/src/anchor/src/AnchorAdapter.tsx +++ b/src/anchor/src/AnchorAdapter.tsx @@ -1,15 +1,9 @@ -import { - h, - defineComponent, - computed, - ref, - CSSProperties, - ExtractPropTypes -} from 'vue' +import { h, defineComponent, computed, ref, CSSProperties } from 'vue' import { NAffix } from '../../affix' import { affixProps, affixPropKeys } from '../../affix/src/Affix' import { useConfig, useTheme } from '../../_mixins' import type { ThemeProps } from '../../_mixins' +import type { ExtractPublicPropTypes } from '../../_utils' import { keep } from '../../_utils' import { anchorLight } from '../styles' import type { AnchorTheme } from '../styles' @@ -31,7 +25,7 @@ const anchorProps = { ...baseAnchorProps } as const -export type AnchorProps = Partial> +export type AnchorProps = ExtractPublicPropTypes export default defineComponent({ name: 'Anchor', diff --git a/src/anchor/src/Link.tsx b/src/anchor/src/Link.tsx index 65c5b8686..effa9ff3c 100644 --- a/src/anchor/src/Link.tsx +++ b/src/anchor/src/Link.tsx @@ -6,7 +6,6 @@ import { renderSlot, defineComponent, watch, - ExtractPropTypes, Ref, InjectionKey } from 'vue' @@ -15,6 +14,7 @@ import { useInjectionCollection, useInjectionElementCollection } from '../../_utils/composable' +import type { ExtractPublicPropTypes } from '../../_utils' export interface AnchorInjection { activeHref: Ref @@ -34,7 +34,7 @@ const anchorLinkProps = { href: String } as const -export type AnchorLinkProps = Partial> +export type AnchorLinkProps = ExtractPublicPropTypes export default defineComponent({ name: 'AnchorLink', diff --git a/src/auto-complete/src/AutoComplete.tsx b/src/auto-complete/src/AutoComplete.tsx index 83f755811..211793231 100644 --- a/src/auto-complete/src/AutoComplete.tsx +++ b/src/auto-complete/src/AutoComplete.tsx @@ -7,8 +7,7 @@ import { Transition, PropType, withDirectives, - CSSProperties, - ExtractPropTypes + CSSProperties } from 'vue' import { createTreeMate } from 'treemate' import { VBinder, VTarget, VFollower } from 'vueuc' @@ -22,6 +21,7 @@ import { MaybeArray, getFirstSlotVNode } from '../../_utils' +import type { ExtractPublicPropTypes } from '../../_utils' import { NInternalSelectMenu, InternalSelectMenuRef } from '../../_internal' import { NInput } from '../../input' @@ -98,9 +98,7 @@ const autoCompleteProps = { } } as const -export type AutoCompleteProps = Partial< -ExtractPropTypes -> +export type AutoCompleteProps = ExtractPublicPropTypes export default defineComponent({ name: 'AutoComplete', diff --git a/src/avatar/src/Avatar.tsx b/src/avatar/src/Avatar.tsx index fd68a4b45..3702fef6a 100644 --- a/src/avatar/src/Avatar.tsx +++ b/src/avatar/src/Avatar.tsx @@ -5,14 +5,14 @@ import { onUpdated, onMounted, defineComponent, - PropType, - ExtractPropTypes + PropType } from 'vue' import { useConfig, useTheme } from '../../_mixins' import type { ThemeProps } from '../../_mixins' import { avatarLight } from '../styles' import type { AvatarTheme } from '../styles' import { createKey } from '../../_utils' +import type { ExtractPublicPropTypes } from '../../_utils' import style from './styles/index.cssr' const avatarProps = { @@ -35,7 +35,7 @@ const avatarProps = { color: String } as const -export type AvatarProps = Partial> +export type AvatarProps = ExtractPublicPropTypes export default defineComponent({ name: 'Avatar', diff --git a/src/back-top/src/BackTop.tsx b/src/back-top/src/BackTop.tsx index d3a8d0f17..d6dca9bd9 100644 --- a/src/back-top/src/BackTop.tsx +++ b/src/back-top/src/BackTop.tsx @@ -11,8 +11,7 @@ import { Transition, PropType, onMounted, - onBeforeUnmount, - ExtractPropTypes + onBeforeUnmount } from 'vue' import { VLazyTeleport } from 'vueuc' import { useIsMounted, useMergedState } from 'vooks' @@ -21,6 +20,7 @@ import { useConfig, useTheme } from '../../_mixins' import type { ThemeProps } from '../../_mixins' import { NBaseIcon } from '../../_internal' import { formatLength, warn } from '../../_utils' +import type { ExtractPublicPropTypes } from '../../_utils' import { backTopLight } from '../styles' import type { BackTopTheme } from '../styles' import BackTopIcon from './BackTopIcon' @@ -92,7 +92,7 @@ const backTopProps = { } } as const -export type BackTopProps = Partial> +export type BackTopProps = ExtractPublicPropTypes export default defineComponent({ name: 'BackTop', diff --git a/src/badge/src/Badge.tsx b/src/badge/src/Badge.tsx index b8f5586d2..ea4665b55 100644 --- a/src/badge/src/Badge.tsx +++ b/src/badge/src/Badge.tsx @@ -7,13 +7,13 @@ import { defineComponent, renderSlot, Transition, - CSSProperties, - ExtractPropTypes + CSSProperties } from 'vue' import { useConfig, useTheme } from '../../_mixins' import type { ThemeProps } from '../../_mixins' import { NBaseSlotMachine, NBaseWave } from '../../_internal' import { createKey } from '../../_utils' +import type { ExtractPublicPropTypes } from '../../_utils' import { badgeLight } from '../styles' import type { BadgeTheme } from '../styles' import style from './styles/index.cssr' @@ -47,7 +47,7 @@ const badgeProps = { color: String } as const -export type BadgeProps = Partial> +export type BadgeProps = ExtractPublicPropTypes export default defineComponent({ name: 'Badge', diff --git a/src/breadcrumb/src/Breadcrumb.tsx b/src/breadcrumb/src/Breadcrumb.tsx index baa3e5763..ba356b3a7 100644 --- a/src/breadcrumb/src/Breadcrumb.tsx +++ b/src/breadcrumb/src/Breadcrumb.tsx @@ -4,7 +4,6 @@ import { defineComponent, CSSProperties, provide, - ExtractPropTypes, InjectionKey, Ref, toRef @@ -14,6 +13,7 @@ import type { ThemeProps } from '../../_mixins' import { breadcrumbLight } from '../styles' import type { BreadcrumbTheme } from '../styles' import style from './styles/index.cssr' +import type { ExtractPublicPropTypes } from '../../_utils' export interface BreadcrumbInjection { separatorRef: Ref @@ -32,7 +32,7 @@ const breadcrumbProps = { } } as const -export type BreadcrumbProps = Partial> +export type BreadcrumbProps = ExtractPublicPropTypes export default defineComponent({ name: 'Breadcrumb', diff --git a/src/button/src/Button.tsx b/src/button/src/Button.tsx index 2a9c658cd..3da05e755 100644 --- a/src/button/src/Button.tsx +++ b/src/button/src/Button.tsx @@ -7,8 +7,7 @@ import { defineComponent, PropType, renderSlot, - CSSProperties, - ExtractPropTypes + CSSProperties } from 'vue' import { useMemo } from 'vooks' import { createHoverColor, createPressedColor } from '../../_utils/color/index' @@ -22,7 +21,7 @@ import { } from '../../_internal' import type { BaseWaveRef } from '../../_internal' import { call, createKey } from '../../_utils' -import type { MaybeArray } from '../../_utils' +import type { ExtractPublicPropTypes, MaybeArray } from '../../_utils' import { buttonLight } from '../styles' import type { ButtonTheme } from '../styles' import { buttonGroupInjectionKey } from './ButtonGroup' @@ -92,7 +91,7 @@ const buttonProps = { } } as const -export type ButtonProps = Partial> +export type ButtonProps = ExtractPublicPropTypes export default defineComponent({ name: 'Button', diff --git a/src/button/src/ButtonGroup.tsx b/src/button/src/ButtonGroup.tsx index 8f9d7f8f6..eac32ac9f 100644 --- a/src/button/src/ButtonGroup.tsx +++ b/src/button/src/ButtonGroup.tsx @@ -1,12 +1,6 @@ -import { - h, - PropType, - defineComponent, - provide, - InjectionKey, - ExtractPropTypes -} from 'vue' +import { h, PropType, defineComponent, provide, InjectionKey } from 'vue' import { useConfig, useStyle } from '../../_mixins' +import type { ExtractPublicPropTypes } from '../../_utils' import type { Size } from './interface' import style from './styles/button-group.cssr' @@ -26,9 +20,7 @@ const buttonGroupProps = { vertical: Boolean } as const -export type ButtonGroupProps = Partial< -ExtractPropTypes -> +export type ButtonGroupProps = ExtractPublicPropTypes export default defineComponent({ name: 'ButtonGroup', diff --git a/src/calendar/src/Calendar.tsx b/src/calendar/src/Calendar.tsx index 233d4ec57..e6481bd9b 100644 --- a/src/calendar/src/Calendar.tsx +++ b/src/calendar/src/Calendar.tsx @@ -1,7 +1,6 @@ import { computed, defineComponent, - ExtractPropTypes, h, ref, PropType, @@ -23,7 +22,8 @@ import { useMergedState } from 'vooks' import { dateArray } from '../../date-picker/src/utils' import { ChevronLeftIcon, ChevronRightIcon } from '../../_internal/icons' import { NBaseIcon } from '../../_internal' -import { call, MaybeArray } from '../../_utils' +import { call } from '../../_utils' +import type { ExtractPublicPropTypes, MaybeArray } from '../../_utils' import { NButton, NButtonGroup } from '../../button' import { useConfig, useLocale, useTheme } from '../../_mixins' import type { ThemeProps } from '../../_mixins' @@ -47,7 +47,7 @@ const calendarProps = { > } as const -export type CalendarProps = Partial> +export type CalendarProps = ExtractPublicPropTypes interface DateItem { year: number diff --git a/src/card/src/Card.tsx b/src/card/src/Card.tsx index 11b48368d..865c8746d 100644 --- a/src/card/src/Card.tsx +++ b/src/card/src/Card.tsx @@ -4,12 +4,12 @@ import { computed, PropType, renderSlot, - CSSProperties, - ExtractPropTypes + CSSProperties } from 'vue' import { useConfig, useTheme } from '../../_mixins' import type { ThemeProps } from '../../_mixins' -import { call, createKey, keysOf, MaybeArray } from '../../_utils' +import { call, createKey, keysOf } from '../../_utils' +import type { ExtractPublicPropTypes, MaybeArray } from '../../_utils' import { NBaseClose } from '../../_internal' import { cardLight } from '../styles' import type { CardTheme } from '../styles' @@ -54,7 +54,7 @@ const cardProps = { ...cardBaseProps } -export type CardProps = Partial> +export type CardProps = ExtractPublicPropTypes export default defineComponent({ name: 'Card',