Skip to content

Commit 44be603

Browse files
committed
feat(types): expose public interfaces
closes #16680 closes #19723 closes #21052
1 parent e079c0d commit 44be603

File tree

13 files changed

+84
-54
lines changed

13 files changed

+84
-54
lines changed

packages/api-generator/src/types.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,14 +318,14 @@ const allowedRefs = [
318318
'Group',
319319
'InternalDataTableHeader',
320320
'ListItem',
321-
'LocationStrategyFn',
322-
'OpenSelectStrategyFn',
321+
'LocationStrategyFunction',
322+
'OpenSelectStrategyFunction',
323323
'OpenStrategy',
324-
'OpenStrategyFn',
325-
'ScrollStrategyFn',
324+
'OpenStrategyFunction',
325+
'ScrollStrategyFunction',
326326
'SelectItemKey',
327327
'SelectStrategy',
328-
'SelectStrategyFn',
328+
'SelectStrategyFunction',
329329
'SortItem',
330330
'SubmitEventPromise',
331331
'TemplateRef',

packages/vuetify/src/components/VDataTable/types.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,17 @@ export type ItemKeySlot<T> = ItemSlotBase<T> & {
8282
column: InternalDataTableHeader
8383
}
8484

85-
export type RowProps<T> =
86-
| Record<string, any>
87-
| ((data: Pick<ItemKeySlot<T>, 'index' | 'item' | 'internalItem'>) => Record<string, any>)
88-
89-
export type CellProps<T> =
90-
| Record<string, any>
91-
| ((data: Pick<ItemKeySlot<T>, 'index' | 'item' | 'internalItem' | 'value' | 'column'>) => Record<string, any>)
92-
93-
export type HeaderCellProps =
94-
| Record<string, any>
95-
| ((data: Pick<ItemKeySlot<any>, 'index' | 'item' | 'internalItem' | 'value'>) => Record<string, any>)
85+
export type RowProps<T> = Record<string, any> | RowPropsFunction<T>
86+
export type RowPropsFunction<T> = (
87+
data: Pick<ItemKeySlot<T>, 'index' | 'item' | 'internalItem'>
88+
) => Record<string, any>
89+
90+
export type CellProps<T> = Record<string, any> | CellPropsFunction<T>
91+
export type CellPropsFunction<T> = (
92+
data: Pick<ItemKeySlot<T>, 'index' | 'item' | 'internalItem' | 'value' | 'column'>
93+
) => Record<string, any>
94+
95+
export type HeaderCellProps = Record<string, any> | HeaderCellPropsFunction
96+
export type HeaderCellPropsFunction = (
97+
data: Pick<ItemKeySlot<any>, 'index' | 'item' | 'internalItem' | 'value'>
98+
) => Record<string, any>

packages/vuetify/src/components/VOverlay/locationStrategies.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export interface LocationStrategyData {
3333
isRtl: Ref<boolean>
3434
}
3535

36-
type LocationStrategyFn = (
36+
export type LocationStrategyFunction = (
3737
data: LocationStrategyData,
3838
props: StrategyProps,
3939
contentStyles: Ref<Record<string, string>>
@@ -45,7 +45,7 @@ const locationStrategies = {
4545
}
4646

4747
export interface StrategyProps {
48-
locationStrategy: keyof typeof locationStrategies | LocationStrategyFn
48+
locationStrategy: keyof typeof locationStrategies | LocationStrategyFunction
4949
location: Anchor
5050
origin: Anchor | 'auto' | 'overlap'
5151
offset?: number | string | number[]

packages/vuetify/src/components/VOverlay/scrollStrategies.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export interface ScrollStrategyData {
1414
updateLocation: Ref<((e: Event) => void) | undefined>
1515
}
1616

17-
type ScrollStrategyFn = (data: ScrollStrategyData, props: StrategyProps, scope: EffectScope) => void
17+
export type ScrollStrategyFunction = (data: ScrollStrategyData, props: StrategyProps, scope: EffectScope) => void
1818

1919
const scrollStrategies = {
2020
none: null,
@@ -24,7 +24,7 @@ const scrollStrategies = {
2424
}
2525

2626
export interface StrategyProps {
27-
scrollStrategy: keyof typeof scrollStrategies | ScrollStrategyFn
27+
scrollStrategy: keyof typeof scrollStrategies | ScrollStrategyFunction
2828
contained: boolean | undefined
2929
}
3030

packages/vuetify/src/components/VSnackbarQueue/VSnackbarQueue.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export type VSnackbarQueueSlots<T extends string | SnackbarMessage> = {
2525
}
2626
}
2727

28-
export type SnackbarMessage = Omit<
28+
export type SnackbarMessage = string | Omit<
2929
VSnackbar['$props'],
3030
| 'modelValue'
3131
| 'onUpdate:modelValue'
@@ -50,14 +50,14 @@ export const makeVSnackbarQueueProps = propsFactory({
5050
default: '$vuetify.dismiss',
5151
},
5252
modelValue: {
53-
type: Array as PropType<readonly (string | SnackbarMessage)[]>,
53+
type: Array as PropType<readonly SnackbarMessage[]>,
5454
default: () => [],
5555
},
5656

5757
...omit(makeVSnackbarProps(), ['modelValue']),
5858
}, 'VSnackbarQueue')
5959

60-
export const VSnackbarQueue = genericComponent<new <T extends readonly (string | SnackbarMessage)[]> (
60+
export const VSnackbarQueue = genericComponent<new <T extends readonly SnackbarMessage[]> (
6161
props: {
6262
modelValue?: T
6363
'onUpdate:modelValue'?: (val: T) => void
@@ -69,15 +69,15 @@ export const VSnackbarQueue = genericComponent<new <T extends readonly (string |
6969
props: makeVSnackbarQueueProps(),
7070

7171
emits: {
72-
'update:modelValue': (val: (string | SnackbarMessage)[]) => true,
72+
'update:modelValue': (val: SnackbarMessage[]) => true,
7373
},
7474

7575
setup (props, { emit, slots }) {
7676
const { t } = useLocale()
7777

7878
const isActive = shallowRef(false)
7979
const isVisible = shallowRef(false)
80-
const current = shallowRef<SnackbarMessage>()
80+
const current = shallowRef<Exclude<SnackbarMessage, string>>()
8181

8282
watch(() => props.modelValue.length, (val, oldVal) => {
8383
if (!isVisible.value && val > oldVal) {

packages/vuetify/src/composables/__tests__/display-components.spec.browser.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { page, render } from '@test'
1212
import { ref } from 'vue'
1313

1414
// Types
15-
import type { DisplayBreakpoint } from '@/composables'
15+
import type { DisplayBreakpoint } from '@/composables/display'
1616

1717
describe('display-components', () => {
1818
it('should render items', async () => {

packages/vuetify/src/composables/index.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,3 @@ export { useGoTo } from './goto'
1010
export { useLayout } from './layout'
1111
export { useLocale, useRtl } from './locale'
1212
export { useTheme } from './theme'
13-
14-
export type { DateInstance } from './date'
15-
export type { DefaultsInstance } from './defaults'
16-
export type { DisplayBreakpoint, DisplayInstance, DisplayThresholds } from './display'
17-
export type { SubmitEventPromise } from './form'
18-
export type { GoToInstance } from './goto'
19-
export type { IconAliases, IconProps, IconSet, IconOptions } from './icons'
20-
export type { LocaleInstance, LocaleMessages, RtlInstance, LocaleOptions, RtlOptions } from './locale'
21-
export type { ThemeDefinition, ThemeInstance } from './theme'
22-
export type { JSXComponent } from '@/util'

packages/vuetify/src/composables/nested/activeStrategies.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { toRaw } from 'vue'
44
import { wrapInArray } from '@/util'
55

6-
export type ActiveStrategyFn = (data: {
6+
type ActiveStrategyFunction = (data: {
77
id: unknown
88
value: boolean
99
activated: Set<unknown>
@@ -12,22 +12,22 @@ export type ActiveStrategyFn = (data: {
1212
event?: Event
1313
}) => Set<unknown>
1414

15-
export type ActiveStrategyTransformInFn = (
15+
type ActiveStrategyTransformInFunction = (
1616
v: unknown | undefined,
1717
children: Map<unknown, unknown[]>,
1818
parents: Map<unknown, unknown>,
1919
) => Set<unknown>
2020

21-
export type ActiveStrategyTransformOutFn = (
21+
type ActiveStrategyTransformOutFunction = (
2222
v: Set<unknown>,
2323
children: Map<unknown, unknown[]>,
2424
parents: Map<unknown, unknown>,
2525
) => unknown
2626

2727
export type ActiveStrategy = {
28-
activate: ActiveStrategyFn
29-
in: ActiveStrategyTransformInFn
30-
out: ActiveStrategyTransformOutFn
28+
activate: ActiveStrategyFunction
29+
in: ActiveStrategyTransformInFunction
30+
out: ActiveStrategyTransformOutFunction
3131
}
3232

3333
export const independentActiveStrategy = (mandatory?: boolean): ActiveStrategy => {

packages/vuetify/src/composables/nested/openStrategies.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export type OpenStrategyFn = (data: {
1+
type OpenStrategyFunction = (data: {
22
id: unknown
33
value: boolean
44
opened: Set<unknown>
@@ -7,7 +7,7 @@ export type OpenStrategyFn = (data: {
77
event?: Event
88
}) => Set<unknown>
99

10-
export type OpenSelectStrategyFn = (data: {
10+
type OpenSelectStrategyFunction = (data: {
1111
id: unknown
1212
value: boolean
1313
opened: Set<unknown>
@@ -18,8 +18,8 @@ export type OpenSelectStrategyFn = (data: {
1818
}) => Set<unknown> | null
1919

2020
export type OpenStrategy = {
21-
open: OpenStrategyFn
22-
select: OpenSelectStrategyFn
21+
open: OpenStrategyFunction
22+
select: OpenSelectStrategyFunction
2323
}
2424

2525
export const singleOpenStrategy: OpenStrategy = {

packages/vuetify/src/composables/nested/selectStrategies.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Utilities
33
import { toRaw } from 'vue'
44

5-
export type SelectStrategyFn = (data: {
5+
type SelectStrategyFunction = (data: {
66
id: unknown
77
value: boolean
88
selected: Map<unknown, 'on' | 'off' | 'indeterminate'>
@@ -11,22 +11,22 @@ export type SelectStrategyFn = (data: {
1111
event?: Event
1212
}) => Map<unknown, 'on' | 'off' | 'indeterminate'>
1313

14-
export type SelectStrategyTransformInFn = (
14+
type SelectStrategyTransformInFunction = (
1515
v: readonly unknown[] | undefined,
1616
children: Map<unknown, unknown[]>,
1717
parents: Map<unknown, unknown>,
1818
) => Map<unknown, 'on' | 'off' | 'indeterminate'>
1919

20-
export type SelectStrategyTransformOutFn = (
20+
type SelectStrategyTransformOutFunction = (
2121
v: Map<unknown, 'on' | 'off' | 'indeterminate'>,
2222
children: Map<unknown, unknown[]>,
2323
parents: Map<unknown, unknown>,
2424
) => unknown[]
2525

2626
export type SelectStrategy = {
27-
select: SelectStrategyFn
28-
in: SelectStrategyTransformInFn
29-
out: SelectStrategyTransformOutFn
27+
select: SelectStrategyFunction
28+
in: SelectStrategyTransformInFunction
29+
out: SelectStrategyTransformOutFunction
3030
}
3131

3232
export const independentSelectStrategy = (mandatory?: boolean): SelectStrategy => {

0 commit comments

Comments
 (0)